package com.generate.library;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;


public abstract class DelayTask
{
	public abstract void run();

	public void delay(int miliseconds)
	{
		ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
		Runnable task = new Runnable()
		{
			public void run()
			{
				DelayTask.this.run();
			}
		};
		worker.schedule(task, miliseconds, TimeUnit.MILLISECONDS);
	}
}
